import {host} from "@/utils/config";
export function formatDateTime (date) {
    const year = date.getFullYear();
    const month = (date.getMonth() + 1).toString().padStart(2, '0');
    const day = date.getDate().toString().padStart(2, '0');
    const hour = date.getHours().toString().padStart(2, '0');
    const minute = date.getMinutes().toString().padStart(2, '0');
    const second = date.getSeconds().toString().padStart(2, '0');
    const formattedDate = `${year}-${month}-${day} ${hour}:${minute}:${second}`;
    console.log('formattedDate', formattedDate);
    return formattedDate
}
export function formatDateTimeArray (date) {
    return `${date[0]}-${date[1]}-${date[2]} ${date[3]}:${date[4]}:${date[5] || '00'}`
}

export function getFileName(path) {
    const tmpArr = path.split('/')
    const name = tmpArr[tmpArr.length - 1]
    const tmpArr1 = name.split('.')
    const extname = tmpArr1[tmpArr1.length - 1]
    return [name, extname]
}

export function getPermissions (func) {
    const permissions = uni.getStorageSync('userInfo').permissions.map(item => item.replace('system', ''))
    return permissions.some(item => item.includes(func))
}
